<template>
  <!--系统管理-->
  <el-row style="height:100%">
    <page></page>
  </el-row>
</template>

<script>
  import page from "@/components/page/page";
  export default {
    data() {
      return {
        value:[],
        options:[],
        props:{
          expandTrigger:'hover',
          emitPath:'true',
          checkStrictly:'true'
        }
      }
    },
    components: {
      page,
    },
    created(){
      //跳转到第一个系统管理的路由
      let url = '/sys/menu/auth_menus'
      this.$api.get(url)
      .then(data =>{
        let _data = data.data
        // console.log(_data);
        let menuTree = {}
        for(let i in _data){
          if(_data[i].menu_url == 'sysHome') menuTree = _data[i]
        }

        let deepTraversal1 = (node, nodeList = []) => {
          if (node !== null) {
            nodeList.push(node)
            let children = node.children
            for (let i = 0; i < children.length; i++) {
              deepTraversal1(children[i], nodeList)
            }
          }
          return nodeList
        }

        let menu_url_arr = deepTraversal1(menuTree).filter(x=>{
          return x.menu_url != 'sysHome' && x.menu_url != ''
        }).map(x=>x.menu_url)
        // console.log(menu_url_arr,'menu_url_arr');
        if(!menu_url_arr || menu_url_arr.length == 0){
          this.$message.warning('系统管理菜单中，没有配置菜单权限！')
          this.$Bus.$emit('Loading',false);
        }else{
          this.$router.push(menu_url_arr[0])
        }

      })
    },
    methods:{},
  }
</script>

<style>
</style>